<!DOCTYPE html>
<!-- saved from url=(0046)https://www.zybuluo.com/hanbingtao/note/433855 -->
<html class="theme theme-white"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    
    <meta name="description" content="Cmd Markdown 编辑阅读器，支持实时同步预览，区分写作和阅读模式，支持在线存储，分享文稿网址。">
    <meta name="author" content="Jiawei Zhang">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    
    <title>零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器</title>


    <link href="https://www.zybuluo.com/static/img/favicon.png" type="image/x-icon" rel="icon">

    <link href="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/1bc053c8.base.lib.min.css" rel="stylesheet" media="screen">


    
    <!-- id="prettify-style" will be used to get the link element below and change href to change prettify code, so it can't be in beginmin/endmin block. -->
    <link id="prettify-style" href="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/prettify-cmd.css" type="text/css" rel="stylesheet">
    <!--
    <link id="mermaid-style" href="https://www.zybuluo.com/static/editor/libs/mermaid/mermaid.forest.css" type="text/css" rel="stylesheet">
    -->
    <link href="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/45c7d56d.layout.min.css" rel="stylesheet" media="screen">


    

    <script async="" src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/analytics.js"></script><script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-44461741-1', 'zybuluo.com');
      ga('send', 'pageview');
    </script>
<style type="text/css">.MathJax_Hover_Frame {border-radius: .25em; -webkit-border-radius: .25em; -moz-border-radius: .25em; -khtml-border-radius: .25em; box-shadow: 0px 0px 15px #83A; -webkit-box-shadow: 0px 0px 15px #83A; -moz-box-shadow: 0px 0px 15px #83A; -khtml-box-shadow: 0px 0px 15px #83A; border: 1px solid #A6D ! important; display: inline-block; position: absolute}
.MathJax_Hover_Arrow {position: absolute; width: 15px; height: 11px; cursor: pointer}
</style><style type="text/css">#MathJax_About {position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDDDDD; color: black; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 15px; -webkit-border-radius: 15px; -moz-border-radius: 15px; -khtml-border-radius: 15px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_Menu {position: absolute; background-color: white; color: black; width: auto; padding: 5px 0px; border: 1px solid #CCCCCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; z-index: 201; border-radius: 5px; -webkit-border-radius: 5px; -moz-border-radius: 5px; -khtml-border-radius: 5px; box-shadow: 0px 10px 20px #808080; -webkit-box-shadow: 0px 10px 20px #808080; -moz-box-shadow: 0px 10px 20px #808080; -khtml-box-shadow: 0px 10px 20px #808080; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
.MathJax_MenuItem {padding: 1px 2em; background: transparent}
.MathJax_MenuArrow {position: absolute; right: .5em; color: #666666}
.MathJax_MenuActive .MathJax_MenuArrow {color: white}
.MathJax_MenuCheck {position: absolute; left: .7em}
.MathJax_MenuRadioCheck {position: absolute; left: .7em}
.MathJax_MenuLabel {padding: 1px 2em 3px 1.33em; font-style: italic}
.MathJax_MenuRule {border-top: 1px solid #DDDDDD; margin: 4px 3px}
.MathJax_MenuDisabled {color: GrayText}
.MathJax_MenuActive {background-color: #606872; color: white}
.MathJax_Menu_Close {position: absolute; width: 31px; height: 31px; top: -15px; left: -15px}
</style><style type="text/css">#MathJax_Zoom {position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid black; margin: 0; font-weight: normal; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; box-shadow: 5px 5px 15px #AAAAAA; -webkit-box-shadow: 5px 5px 15px #AAAAAA; -moz-box-shadow: 5px 5px 15px #AAAAAA; -khtml-box-shadow: 5px 5px 15px #AAAAAA; filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color='gray', Positive='true')}
#MathJax_ZoomOverlay {position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
#MathJax_ZoomFrame {position: relative; display: inline-block; height: 0; width: 0}
#MathJax_ZoomEventTrap {position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: white; opacity: 0; filter: alpha(opacity=0)}
</style><style type="text/css">.MathJax_Preview {color: #888}
#MathJax_Message {position: fixed; left: 1em; bottom: 1.5em; background-color: #E6E6E6; border: 1px solid #959595; margin: 0px; padding: 2px 8px; z-index: 102; color: black; font-size: 80%; width: auto; white-space: nowrap}
#MathJax_MSIE_Frame {position: absolute; top: 0; left: 0; width: 0px; z-index: 101; border: 0px; margin: 0px; padding: 0px}
.MathJax_Error {color: #CC0000; font-style: italic}
</style><style type="text/css">.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block; width: 100%}
#MathJax_SVG_Tooltip {background-color: InfoBackground; color: InfoText; border: 1px solid black; box-shadow: 2px 2px 5px #AAAAAA; -webkit-box-shadow: 2px 2px 5px #AAAAAA; -moz-box-shadow: 2px 2px 5px #AAAAAA; -khtml-box-shadow: 2px 2px 5px #AAAAAA; padding: 3px 4px; z-index: 401; position: absolute; left: 0; top: 0; width: auto; height: auto; display: none}
.MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: 0; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; border: 0; padding: 0; margin: 0}
.MathJax_SVG * {transition: none; -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none}
.mjx-svg-href {fill: blue; stroke: blue}
.MathJax_SVG_Processing {visibility: hidden; position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: hidden; display: block}
.MathJax_SVG_Processed {display: none!important}
.MathJax_SVG_ExBox {display: block; overflow: hidden; width: 1px; height: 60ex}
.MathJax_SVG .noError {vertical-align: ; font-size: 90%; text-align: left; color: black; padding: 1px 3px; border: 1px solid}
</style></head>

<body class="theme  theme-white pace-done"><div style="visibility: hidden; overflow: hidden; position: absolute; top: 0px; height: 1px; width: auto; padding: 0px; border: 0px; margin: 0px; text-align: left; text-indent: 0px; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal;"><div id="MathJax_SVG_Hidden"></div><svg><defs id="MathJax_SVG_glyphs"><path id="MJMAIN-28" stroke-width="1" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path><path id="MJMATHI-78" stroke-width="1" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path><path id="MJMAIN-31" stroke-width="1" d="M213 578L200 573Q186 568 160 563T102 556H83V602H102Q149 604 189 617T245 641T273 663Q275 666 285 666Q294 666 302 660V361L303 61Q310 54 315 52T339 48T401 46H427V0H416Q395 3 257 3Q121 3 100 0H88V46H114Q136 46 152 46T177 47T193 50T201 52T207 57T213 61V578Z"></path><path id="MJMAIN-2C" stroke-width="1" d="M78 35T78 60T94 103T137 121Q165 121 187 96T210 8Q210 -27 201 -60T180 -117T154 -158T130 -185T117 -194Q113 -194 104 -185T95 -172Q95 -168 106 -156T131 -126T157 -76T173 -3V9L172 8Q170 7 167 6T161 3T152 1T140 0Q113 0 96 17Z"></path><path id="MJMAIN-32" stroke-width="1" d="M109 429Q82 429 66 447T50 491Q50 562 103 614T235 666Q326 666 387 610T449 465Q449 422 429 383T381 315T301 241Q265 210 201 149L142 93L218 92Q375 92 385 97Q392 99 409 186V189H449V186Q448 183 436 95T421 3V0H50V19V31Q50 38 56 46T86 81Q115 113 136 137Q145 147 170 174T204 211T233 244T261 278T284 308T305 340T320 369T333 401T340 431T343 464Q343 527 309 573T212 619Q179 619 154 602T119 569T109 550Q109 549 114 549Q132 549 151 535T170 489Q170 464 154 447T109 429Z"></path><path id="MJMAIN-2E" stroke-width="1" d="M78 60Q78 84 95 102T138 120Q162 120 180 104T199 61Q199 36 182 18T139 0T96 17T78 60Z"></path><path id="MJMATHI-6E" stroke-width="1" d="M21 287Q22 293 24 303T36 341T56 388T89 425T135 442Q171 442 195 424T225 390T231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336T465 179T427 52Q427 26 444 26Q450 26 453 27Q482 32 505 65T540 145Q542 153 560 153Q580 153 580 145Q580 144 576 130Q568 101 554 73T508 17T439 -10Q392 -10 371 17T350 73Q350 92 386 193T423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 112 180T152 343Q153 348 153 366Q153 405 129 405Q91 405 66 305Q60 285 60 284Q58 278 41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-2223" stroke-width="1" d="M139 -249H137Q125 -249 119 -235V251L120 737Q130 750 139 750Q152 750 159 735V-235Q151 -249 141 -249H139Z"></path><path id="MJMATHI-69" stroke-width="1" d="M184 600Q184 624 203 642T247 661Q265 661 277 649T290 619Q290 596 270 577T226 557Q211 557 198 567T184 600ZM21 287Q21 295 30 318T54 369T98 420T158 442Q197 442 223 419T250 357Q250 340 236 301T196 196T154 83Q149 61 149 51Q149 26 166 26Q175 26 185 29T208 43T235 78T260 137Q263 149 265 151T282 153Q302 153 302 143Q302 135 293 112T268 61T223 11T161 -11Q129 -11 102 10T74 74Q74 91 79 106T122 220Q160 321 166 341T173 380Q173 404 156 404H154Q124 404 99 371T61 287Q60 286 59 284T58 281T56 279T53 278T49 278T41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-2208" stroke-width="1" d="M84 250Q84 372 166 450T360 539Q361 539 377 539T419 540T469 540H568Q583 532 583 520Q583 511 570 501L466 500Q355 499 329 494Q280 482 242 458T183 409T147 354T129 306T124 272V270H568Q583 262 583 250T568 230H124V228Q124 207 134 177T167 112T231 48T328 7Q355 1 466 0H570Q583 -10 583 -20Q583 -32 568 -40H471Q464 -40 446 -40T417 -41Q262 -41 172 45Q84 127 84 250Z"></path><path id="MJFRAK-52" stroke-width="1" d="M27 496Q31 569 102 627T234 685Q236 685 241 685T251 686Q287 686 318 672T367 638T399 598T418 564L423 550Q424 554 434 567T463 601T505 639T561 671T626 685Q672 685 688 659T710 572Q713 533 721 523T766 513Q781 513 787 514T794 516Q796 512 798 509T801 504T802 501T787 493Q702 461 624 401L607 389Q655 383 688 358L697 352V342Q699 330 699 297Q704 209 710 173T734 103Q751 69 765 69Q769 69 806 83L824 90V74Q823 73 759 24T693 -26Q692 -26 660 32L628 90L629 111Q631 159 631 177Q631 278 614 300Q584 340 523 340Q500 340 467 333T431 325Q429 325 429 322Q428 321 426 308T420 275T410 230T392 178T366 125L358 112L342 99Q306 70 269 38T213 -10T193 -26Q192 -26 163 0T116 26Q82 26 50 -8L42 -16L35 -8L27 0L35 10Q43 21 58 38T104 80T158 106Q179 106 218 65L235 48Q238 48 255 60T295 99T329 158Q352 231 352 359Q352 555 242 614Q210 628 187 628Q140 628 116 600T91 548Q91 522 138 464T185 382V376Q185 345 158 313T103 263L76 246Q74 244 64 253L54 260L65 267Q91 285 100 302Q111 318 111 337Q111 355 69 410T27 496ZM562 628Q504 628 443 507L435 491L436 479Q437 471 437 446Q437 396 432 351L529 389L602 426Q673 462 673 463H672Q644 470 637 483T622 553Q608 628 562 628Z"></path><path id="MJMAIN-29" stroke-width="1" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path><path id="MJMATHI-77" stroke-width="1" d="M580 385Q580 406 599 424T641 443Q659 443 674 425T690 368Q690 339 671 253Q656 197 644 161T609 80T554 12T482 -11Q438 -11 404 5T355 48Q354 47 352 44Q311 -11 252 -11Q226 -11 202 -5T155 14T118 53T104 116Q104 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Q21 293 29 315T52 366T96 418T161 441Q204 441 227 416T250 358Q250 340 217 250T184 111Q184 65 205 46T258 26Q301 26 334 87L339 96V119Q339 122 339 128T340 136T341 143T342 152T345 165T348 182T354 206T362 238T373 281Q402 395 406 404Q419 431 449 431Q468 431 475 421T483 402Q483 389 454 274T422 142Q420 131 420 107V100Q420 85 423 71T442 42T487 26Q558 26 600 148Q609 171 620 213T632 273Q632 306 619 325T593 357T580 385Z"></path><path id="MJMATHI-62" stroke-width="1" d="M73 647Q73 657 77 670T89 683Q90 683 161 688T234 694Q246 694 246 685T212 542Q204 508 195 472T180 418L176 399Q176 396 182 402Q231 442 283 442Q345 442 383 396T422 280Q422 169 343 79T173 -11Q123 -11 82 27T40 150V159Q40 180 48 217T97 414Q147 611 147 623T109 637Q104 637 101 637H96Q86 637 83 637T76 640T73 647ZM336 325V331Q336 405 275 405Q258 405 240 397T207 376T181 352T163 330L157 322L136 236Q114 150 114 114Q114 66 138 42Q154 26 178 26Q211 26 245 58Q270 81 285 114T318 219Q336 291 336 325Z"></path><path id="MJMAIN-30" stroke-width="1" d="M96 585Q152 666 249 666Q297 666 345 640T423 548Q460 465 460 320Q460 165 417 83Q397 41 362 16T301 -15T250 -22Q224 -22 198 -16T137 16T82 83Q39 165 39 320Q39 494 96 585ZM321 597Q291 629 250 629Q208 629 178 597Q153 571 145 525T137 333Q137 175 145 125T181 46Q209 16 250 16Q290 16 318 46Q347 76 354 130T362 333Q362 478 354 524T321 597Z"></path><path id="MJMATHI-66" stroke-width="1" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path><path id="MJMATHI-7A" stroke-width="1" d="M347 338Q337 338 294 349T231 360Q211 360 197 356T174 346T162 335T155 324L153 320Q150 317 138 317Q117 317 117 325Q117 330 120 339Q133 378 163 406T229 440Q241 442 246 442Q271 442 291 425T329 392T367 375Q389 375 411 408T434 441Q435 442 449 442H462Q468 436 468 434Q468 430 463 420T449 399T432 377T418 358L411 349Q368 298 275 214T160 106L148 94L163 93Q185 93 227 82T290 71Q328 71 360 90T402 140Q406 149 409 151T424 153Q443 153 443 143Q443 138 442 134Q425 72 376 31T278 -11Q252 -11 232 6T193 40T155 57Q111 57 76 -3Q70 -11 59 -11H54H41Q35 -5 35 -2Q35 13 93 84Q132 129 225 214T340 322Q352 338 347 338Z"></path><path id="MJMAIN-3D" stroke-width="1" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path><path id="MJMAIN-7B" stroke-width="1" d="M434 -231Q434 -244 428 -250H410Q281 -250 230 -184Q225 -177 222 -172T217 -161T213 -148T211 -133T210 -111T209 -84T209 -47T209 0Q209 21 209 53Q208 142 204 153Q203 154 203 155Q189 191 153 211T82 231Q71 231 68 234T65 250T68 266T82 269Q116 269 152 289T203 345Q208 356 208 377T209 529V579Q209 634 215 656T244 698Q270 724 324 740Q361 748 377 749Q379 749 390 749T408 750H428Q434 744 434 732Q434 719 431 716Q429 713 415 713Q362 710 332 689T296 647Q291 634 291 499V417Q291 370 288 353T271 314Q240 271 184 255L170 250L184 245Q202 239 220 230T262 196T290 137Q291 131 291 1Q291 -134 296 -147Q306 -174 339 -192T415 -213Q429 -213 431 -216Q434 -219 434 -231Z"></path><path id="MJMAIN-3E" stroke-width="1" d="M84 520Q84 528 88 533T96 539L99 540Q106 540 253 471T544 334L687 265Q694 260 694 250T687 235Q685 233 395 96L107 -40H101Q83 -38 83 -20Q83 -19 83 -17Q82 -10 98 -1Q117 9 248 71Q326 108 378 132L626 250L378 368Q90 504 86 509Q84 513 84 520Z"></path><path id="MJMATHI-6F" stroke-width="1" d="M201 -11Q126 -11 80 38T34 156Q34 221 64 279T146 380Q222 441 301 441Q333 441 341 440Q354 437 367 433T402 417T438 387T464 338T476 268Q476 161 390 75T201 -11ZM121 120Q121 70 147 48T206 26Q250 26 289 58T351 142Q360 163 374 216T388 308Q388 352 370 375Q346 405 306 405Q243 405 195 347Q158 303 140 230T121 120Z"></path><path id="MJMATHI-74" stroke-width="1" d="M26 385Q19 392 19 395Q19 399 22 411T27 425Q29 430 36 430T87 431H140L159 511Q162 522 166 540T173 566T179 586T187 603T197 615T211 624T229 626Q247 625 254 615T261 596Q261 589 252 549T232 470L222 433Q222 431 272 431H323Q330 424 330 420Q330 398 317 385H210L174 240Q135 80 135 68Q135 26 162 26Q197 26 230 60T283 144Q285 150 288 151T303 153H307Q322 153 322 145Q322 142 319 133Q314 117 301 95T267 48T216 6T155 -11Q125 -11 98 4T59 56Q57 64 57 83V101L92 241Q127 382 128 383Q128 385 77 385H26Z"></path><path id="MJMATHI-68" stroke-width="1" d="M137 683Q138 683 209 688T282 694Q294 694 294 685Q294 674 258 534Q220 386 220 383Q220 381 227 388Q288 442 357 442Q411 442 444 415T478 336Q478 285 440 178T402 50Q403 36 407 31T422 26Q450 26 474 56T513 138Q516 149 519 151T535 153Q555 153 555 145Q555 144 551 130Q535 71 500 33Q466 -10 419 -10H414Q367 -10 346 17T325 74Q325 90 361 192T398 345Q398 404 354 404H349Q266 404 205 306L198 293L164 158Q132 28 127 16Q114 -11 83 -11Q69 -11 59 -2T48 16Q48 30 121 320L195 616Q195 629 188 632T149 637H128Q122 643 122 645T124 664Q129 683 137 683Z"></path><path id="MJMATHI-65" stroke-width="1" d="M39 168Q39 225 58 272T107 350T174 402T244 433T307 442H310Q355 442 388 420T421 355Q421 265 310 237Q261 224 176 223Q139 223 138 221Q138 219 132 186T125 128Q125 81 146 54T209 26T302 45T394 111Q403 121 406 121Q410 121 419 112T429 98T420 82T390 55T344 24T281 -1T205 -11Q126 -11 83 42T39 168ZM373 353Q367 405 305 405Q272 405 244 391T199 357T170 316T154 280T149 261Q149 260 169 260Q282 260 327 284T373 353Z"></path><path id="MJMATHI-72" stroke-width="1" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q161 442 183 430T214 408T225 388Q227 382 228 382T236 389Q284 441 347 441H350Q398 441 422 400Q430 381 430 363Q430 333 417 315T391 292T366 288Q346 288 334 299T322 328Q322 376 378 392Q356 405 342 405Q286 405 239 331Q229 315 224 298T190 165Q156 25 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMATHI-73" stroke-width="1" d="M131 289Q131 321 147 354T203 415T300 442Q362 442 390 415T419 355Q419 323 402 308T364 292Q351 292 340 300T328 326Q328 342 337 354T354 372T367 378Q368 378 368 379Q368 382 361 388T336 399T297 405Q249 405 227 379T204 326Q204 301 223 291T278 274T330 259Q396 230 396 163Q396 135 385 107T352 51T289 7T195 -10Q118 -10 86 19T53 87Q53 126 74 143T118 160Q133 160 146 151T160 120Q160 94 142 76T111 58Q109 57 108 57T107 55Q108 52 115 47T146 34T201 27Q237 27 263 38T301 66T318 97T323 122Q323 150 302 164T254 181T195 196T148 231Q131 256 131 289Z"></path><path id="MJSZ3-7B" stroke-width="1" d="M618 -943L612 -949H582L568 -943Q472 -903 411 -841T332 -703Q327 -682 327 -653T325 -350Q324 -28 323 -18Q317 24 301 61T264 124T221 171T179 205T147 225T132 234Q130 238 130 250Q130 255 130 258T131 264T132 267T134 269T139 272T144 275Q207 308 256 367Q310 436 323 519Q324 529 325 851Q326 1124 326 1154T332 1205Q369 1358 566 1443L582 1450H612L618 1444V1429Q618 1413 616 1411L608 1406Q599 1402 585 1393T552 1372T515 1343T479 1305T449 1257T429 1200Q425 1180 425 1152T423 851Q422 579 422 549T416 498Q407 459 388 424T346 364T297 318T250 284T214 264T197 254L188 251L205 242Q290 200 345 138T416 3Q421 -18 421 -48T423 -349Q423 -397 423 -472Q424 -677 428 -694Q429 -697 429 -699Q434 -722 443 -743T465 -782T491 -816T519 -845T548 -868T574 -886T595 -899T610 -908L616 -910Q618 -912 618 -928V-943Z"></path><path id="MJMATHI-79" stroke-width="1" d="M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250 355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95 344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391 -23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150 -87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247 -127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103 113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65 302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path><path id="MJMAIN-77" stroke-width="1" d="M90 368Q84 378 76 380T40 385H18V431H24L43 430Q62 430 84 429T116 428Q206 428 221 431H229V385H215Q177 383 177 368Q177 367 221 239L265 113L339 328L333 345Q323 374 316 379Q308 384 278 385H258V431H264Q270 428 348 428Q439 428 454 431H461V385H452Q404 385 404 369Q404 366 418 324T449 234T481 143L496 100L537 219Q579 341 579 347Q579 363 564 373T530 385H522V431H529Q541 428 624 428Q692 428 698 431H703V385H697Q696 385 691 385T682 384Q635 377 619 334L559 161Q546 124 528 71Q508 12 503 1T487 -11H479Q460 -11 456 -4Q455 -3 407 133L361 267Q359 263 266 -4Q261 -11 243 -11H238Q225 -11 220 -3L90 368Z"></path><path id="MJMAIN-2219" stroke-width="1" d="M55 251Q55 328 112 386T249 444T386 388T444 249Q444 171 388 113T250 55Q170 55 113 112T55 251Z"></path><path id="MJMAIN-78" stroke-width="1" d="M201 0Q189 3 102 3Q26 3 17 0H11V46H25Q48 47 67 52T96 61T121 78T139 96T160 122T180 150L226 210L168 288Q159 301 149 315T133 336T122 351T113 363T107 370T100 376T94 379T88 381T80 383Q74 383 44 385H16V431H23Q59 429 126 429Q219 429 229 431H237V385Q201 381 201 369Q201 367 211 353T239 315T268 274L272 270L297 304Q329 345 329 358Q329 364 327 369T322 376T317 380T310 384L307 385H302V431H309Q324 428 408 428Q487 428 493 431H499V385H492Q443 385 411 368Q394 360 377 341T312 257L296 236L358 151Q424 61 429 57T446 50Q464 46 499 46H516V0H510H502Q494 1 482 1T457 2T432 2T414 3Q403 3 377 3T327 1L304 0H295V46H298Q309 46 320 51T331 63Q331 65 291 120L250 175Q249 174 219 133T185 88Q181 83 181 74Q181 63 188 55T206 46Q208 46 208 23V0H201Z"></path><path id="MJMAIN-2B" stroke-width="1" d="M56 237T56 250T70 270H369V420L370 570Q380 583 389 583Q402 583 409 568V270H707Q722 262 722 250T707 230H409V-68Q401 -82 391 -82H389H387Q375 -82 369 -68V230H70Q56 237 56 250Z"></path><path id="MJMAIN-35" stroke-width="1" d="M164 157Q164 133 148 117T109 101H102Q148 22 224 22Q294 22 326 82Q345 115 345 210Q345 313 318 349Q292 382 260 382H254Q176 382 136 314Q132 307 129 306T114 304Q97 304 95 310Q93 314 93 485V614Q93 664 98 664Q100 666 102 666Q103 666 123 658T178 642T253 634Q324 634 389 662Q397 666 402 666Q410 666 410 648V635Q328 538 205 538Q174 538 149 544L139 546V374Q158 388 169 396T205 412T256 420Q337 420 393 355T449 201Q449 109 385 44T229 -22Q148 -22 99 32T50 154Q50 178 61 192T84 210T107 214Q132 214 148 197T164 157Z"></path><path id="MJMAIN-3B" stroke-width="1" d="M78 370Q78 394 95 412T138 430Q162 430 180 414T199 371Q199 346 182 328T139 310T96 327T78 370ZM78 60Q78 85 94 103T137 121Q202 121 202 8Q202 -44 183 -94T144 -169T118 -194Q115 -194 106 -186T95 -174Q94 -171 107 -155T137 -107T160 -38Q161 -32 162 -22T165 -4T165 4Q165 5 161 4T142 0Q110 0 94 18T78 60Z"></path><path id="MJMAIN-2212" stroke-width="1" d="M84 237T84 250T98 270H679Q694 262 694 250T679 230H98Q84 237 84 250Z"></path><path id="MJMAIN-38" stroke-width="1" d="M70 417T70 494T124 618T248 666Q319 666 374 624T429 515Q429 485 418 459T392 417T361 389T335 371T324 363L338 354Q352 344 366 334T382 323Q457 264 457 174Q457 95 399 37T249 -22Q159 -22 101 29T43 155Q43 263 172 335L154 348Q133 361 127 368Q70 417 70 494ZM286 386L292 390Q298 394 301 396T311 403T323 413T334 425T345 438T355 454T364 471T369 491T371 513Q371 556 342 586T275 624Q268 625 242 625Q201 625 165 599T128 534Q128 511 141 492T167 463T217 431Q224 426 228 424L286 386ZM250 21Q308 21 350 55T392 137Q392 154 387 169T375 194T353 216T330 234T301 253T274 270Q260 279 244 289T218 306L210 311Q204 311 181 294T133 239T107 157Q107 98 150 60T250 21Z"></path><path id="MJMAIN-33" stroke-width="1" d="M127 463Q100 463 85 480T69 524Q69 579 117 622T233 665Q268 665 277 664Q351 652 390 611T430 522Q430 470 396 421T302 350L299 348Q299 347 308 345T337 336T375 315Q457 262 457 175Q457 96 395 37T238 -22Q158 -22 100 21T42 130Q42 158 60 175T105 193Q133 193 151 175T169 130Q169 119 166 110T159 94T148 82T136 74T126 70T118 67L114 66Q165 21 238 21Q293 21 321 74Q338 107 338 175V195Q338 290 274 322Q259 328 213 329L171 330L168 332Q166 335 166 348Q166 366 174 366Q202 366 232 371Q266 376 294 413T322 525V533Q322 590 287 612Q265 626 240 626Q208 626 181 615T143 592T132 580H135Q138 579 143 578T153 573T165 566T175 555T183 540T186 520Q186 498 172 481T127 463Z"></path><path id="MJMAIN-34" stroke-width="1" d="M462 0Q444 3 333 3Q217 3 199 0H190V46H221Q241 46 248 46T265 48T279 53T286 61Q287 63 287 115V165H28V211L179 442Q332 674 334 675Q336 677 355 677H373L379 671V211H471V165H379V114Q379 73 379 66T385 54Q393 47 442 46H471V0H462ZM293 211V545L74 212L183 211H293Z"></path><path id="MJMAIN-D7" stroke-width="1" d="M630 29Q630 9 609 9Q604 9 587 25T493 118L389 222L284 117Q178 13 175 11Q171 9 168 9Q160 9 154 15T147 29Q147 36 161 51T255 146L359 250L255 354Q174 435 161 449T147 471Q147 480 153 485T168 490Q173 490 175 489Q178 487 284 383L389 278L493 382Q570 459 587 475T609 491Q630 491 630 471Q630 464 620 453T522 355L418 250L522 145Q606 61 618 48T630 29Z"></path><path id="MJMAIN-36" stroke-width="1" d="M42 313Q42 476 123 571T303 666Q372 666 402 630T432 550Q432 525 418 510T379 495Q356 495 341 509T326 548Q326 592 373 601Q351 623 311 626Q240 626 194 566Q147 500 147 364L148 360Q153 366 156 373Q197 433 263 433H267Q313 433 348 414Q372 400 396 374T435 317Q456 268 456 210V192Q456 169 451 149Q440 90 387 34T253 -22Q225 -22 199 -14T143 16T92 75T56 172T42 313ZM257 397Q227 397 205 380T171 335T154 278T148 216Q148 133 160 97T198 39Q222 21 251 21Q302 21 329 59Q342 77 347 104T352 209Q352 289 347 316T329 361Q302 397 257 397Z"></path><path id="MJMAIN-37" stroke-width="1" d="M55 458Q56 460 72 567L88 674Q88 676 108 676H128V672Q128 662 143 655T195 646T364 644H485V605L417 512Q408 500 387 472T360 435T339 403T319 367T305 330T292 284T284 230T278 162T275 80Q275 66 275 52T274 28V19Q270 2 255 -10T221 -22Q210 -22 200 -19T179 0T168 40Q168 198 265 368Q285 400 349 489L395 552H302Q128 552 119 546Q113 543 108 522T98 479L95 458V455H55V458Z"></path><path id="MJMAIN-39" stroke-width="1" d="M352 287Q304 211 232 211Q154 211 104 270T44 396Q42 412 42 436V444Q42 537 111 606Q171 666 243 666Q245 666 249 666T257 665H261Q273 665 286 663T323 651T370 619T413 560Q456 472 456 334Q456 194 396 97Q361 41 312 10T208 -22Q147 -22 108 7T68 93T121 149Q143 149 158 135T173 96Q173 78 164 65T148 49T135 44L131 43Q131 41 138 37T164 27T206 22H212Q272 22 313 86Q352 142 352 280V287ZM244 248Q292 248 321 297T351 430Q351 508 343 542Q341 552 337 562T323 588T293 615T246 625Q208 625 181 598Q160 576 154 546T147 441Q147 358 152 329T172 282Q197 248 244 248Z"></path><path id="MJMAIN-2190" stroke-width="1" d="M944 261T944 250T929 230H165Q167 228 182 216T211 189T244 152T277 96T303 25Q308 7 308 0Q308 -11 288 -11Q281 -11 278 -11T272 -7T267 2T263 21Q245 94 195 151T73 236Q58 242 55 247Q55 254 59 257T73 264Q121 283 158 314T215 375T247 434T264 480L267 497Q269 503 270 505T275 509T288 511Q308 511 308 500Q308 493 303 475Q293 438 278 406T246 352T215 315T185 287T165 270H929Q944 261 944 250Z"></path><path id="MJMAIN-394" stroke-width="1" d="M51 0Q46 4 46 7Q46 9 215 357T388 709Q391 716 416 716Q439 716 444 709Q447 705 616 357T786 7Q786 4 781 0H51ZM507 344L384 596L137 92L383 91H630Q630 93 507 344Z"></path><path id="MJMATHI-3B7" stroke-width="1" d="M21 287Q22 290 23 295T28 317T38 348T53 381T73 411T99 433T132 442Q156 442 175 435T205 417T221 395T229 376L231 369Q231 367 232 367L243 378Q304 442 382 442Q436 442 469 415T503 336V326Q503 302 439 53Q381 -182 377 -189Q364 -216 332 -216Q319 -216 310 -208T299 -186Q299 -177 358 57L420 307Q423 322 423 345Q423 404 379 404H374Q288 404 229 303L222 291L189 157Q156 26 151 16Q138 -11 108 -11Q95 -11 87 -5T76 7T74 17Q74 30 114 189T154 366Q154 405 128 405Q107 405 92 377T68 316T57 280Q55 278 41 278H27Q21 284 21 287Z"></path></defs></svg></div><div id="MathJax_Message" style="display: none;"></div><div class="pace  pace-inactive"><div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
  <div class="pace-progress-inner"></div>
</div>
<div class="pace-activity"></div></div>

    <div id="global-prompt-alert" class="hide alert alert-warning">
        <span id="global-prompt-message"></span>
        <a id="close-global-prompt-alert" href="https://www.zybuluo.com/hanbingtao/note/433855">[关闭]</a>
    </div>

    <!-- zybuluo's body -->
    







<!-- mdeditor's body -->






<div id="editor-reader-full" class="editor-reader-full-shown" style="position: static; padding-right: 75px;">
    <div id="reader-full-topInfo" class="reader-full-topInfo-shown">
        <span>
            <code>@hanbingtao</code>
        </span>
        <code><span class="article-updated-date">2017-08-28 19:35</span></code>
        <code><span>字数 </span><span class="article-characters">5679</span></code>
        <code><span>阅读 </span><span class="article-read">421712</span></code>
    </div>
    <div id="wmd-preview" class="wmd-preview wmd-preview-full-reader" data-medium-element="true"><div class="md-section-divider"></div><div class="md-section-divider"></div><h1 data-anchor-id="1uus" id="零基础入门深度学习1-感知器">零基础入门深度学习(1) - 感知器</h1><p data-anchor-id="clw6"><code>机器学习</code> <code>深度学习入门</code></p><hr><p data-anchor-id="4s1h"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-06627c71f0d8c0dc.jpg" alt=""></p><blockquote data-anchor-id="49jw" class="white-blockquote">
  <p>无论即将到来的是大数据时代还是人工智能时代，亦或是传统行业使用人工智能在云上处理大数据的时代，作为一个有理想有追求的程序员，不懂深度学习（Deep Learning）这个超热的技术，会不会感觉马上就out了？现在救命稻草来了，《零基础入门深度学习》系列文章旨在讲帮助爱编程的你从零基础达到入门级水平。零基础意味着你不需要太多的数学知识，只要会写程序就行了，没错，这是专门为程序员写的文章。虽然文中会有很多公式你也许看不懂，但同时也会有更多的代码，程序员的你一定能看懂的（我周围是一群狂热的Clean Code程序员，所以我写的代码也不会很差）。</p>
</blockquote><div class="md-section-divider"></div><h2 data-anchor-id="tct5" id="文章列表">文章列表</h2><p data-anchor-id="39pi"><a href="https://www.zybuluo.com/hanbingtao/note/433855" target="_blank">零基础入门深度学习(1) - 感知器</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/448086" target="_blank">零基础入门深度学习(2) - 线性单元和梯度下降</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/476663" target="_blank">零基础入门深度学习(3) - 神经网络和反向传播算法</a> <br>
<a href="https://www.zybuluo.com/hanbingtao/note/485480" target="_blank">零基础入门深度学习(4) - 卷积神经网络</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/541458" target="_blank">零基础入门深度学习(5) - 循环神经网络</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/581764" target="_blank">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</a> <br>
<a href="https://zybuluo.com/hanbingtao/note/626300" target="_blank">零基础入门深度学习(7) - 递归神经网络</a></p><div class="md-section-divider"></div><h2 data-anchor-id="p3bc" id="深度学习是啥">深度学习是啥</h2><p data-anchor-id="ij0c">在人工智能领域，有一个方法叫机器学习。在机器学习这个方法里，有一类算法叫神经网络。神经网络如下图所示：</p><p data-anchor-id="bm8i"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-c6f640c11a06ac2e.png" alt="" title=""></p><p data-anchor-id="l9z0">上图中每个圆圈都是一个神经元，每条线表示神经元之间的连接。我们可以看到，上面的神经元被分成了多层，层与层之间的神经元有连接，而层内之间的神经元没有连接。最左边的层叫做<strong>输入层</strong>，这层负责接收输入数据；最右边的层叫<strong>输出层</strong>，我们可以从这层获取神经网络输出数据。输入层和输出层之间的层叫做<strong>隐藏层</strong>。</p><p data-anchor-id="s1bw">隐藏层比较多（大于2）的神经网络叫做深度神经网络。而深度学习，就是使用深层架构（比如，深度神经网络）的机器学习方法。</p><p data-anchor-id="t4bg">那么深层网络和浅层网络相比有什么优势呢？简单来说深层网络能够表达力更强。事实上，一个仅有一个隐藏层的神经网络就能拟合任何一个函数，但是它需要很多很多的神经元。而深层网络用少得多的神经元就能拟合同样的函数。也就是为了拟合一个函数，要么使用一个浅而宽的网络，要么使用一个深而窄的网络。而后者往往更节约资源。</p><p data-anchor-id="szvi">深层网络也有劣势，就是它不太容易训练。简单的说，你需要大量的数据，很多的技巧才能训练好一个深层网络。这是个手艺活。</p><div class="md-section-divider"></div><h2 data-anchor-id="r9m3" id="感知器">感知器</h2><p data-anchor-id="6ag5">看到这里，如果你还是一头雾水，那也是很正常的。为了理解神经网络，我们应该先理解神经网络的组成单元——<strong>神经元</strong>。神经元也叫做<strong>感知器</strong>。感知器算法在上个世纪50-70年代很流行，也成功解决了很多问题。并且，感知器算法也是非常简单的。</p><div class="md-section-divider"></div><h3 data-anchor-id="k7nn" id="感知器的定义">感知器的定义</h3><p data-anchor-id="tf0a">下图是一个感知器：</p><p data-anchor-id="ijil"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-801d65e79bfc3162.png" alt="" title=""></p><p data-anchor-id="y0ke">可以看到，一个感知器有如下组成部分：</p><ul data-anchor-id="3svx">
<li><p><strong>输入权值</strong> 一个感知器可以接收多个输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-1-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -770.2000693679926 10402.348014081319 1040.4001387359851" style="width: 24.194ex; height: 2.419ex; vertical-align: -0.726ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-28"></use><g transform="translate(389,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="1415" y="0"></use><g transform="translate(1861,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2C" x="2887" y="0"></use><use href="#MJMAIN-2E" x="3332" y="0"></use><use href="#MJMAIN-2E" x="3777" y="0"></use><use href="#MJMAIN-2E" x="4222" y="0"></use><use href="#MJMAIN-2C" x="4668" y="0"></use><g transform="translate(5113,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-6E" x="809" y="-213"></use></g><use href="#MJMAIN-2223" x="6488" y="0"></use><g transform="translate(7044,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="809" y="-213"></use></g><use href="#MJMAIN-2208" x="8239" y="0"></use><use href="#MJFRAK-52" x="9184" y="0"></use><use href="#MJMAIN-29" x="10012" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-1">(x_1, x_2,...,x_n\mid x_i\in\Re)</script>，每个输入上有一个<strong>权值</strong><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-2-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -706.2000693679926 3112.3609484555077 883.8854201102238" style="width: 7.258ex; height: 2.056ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use><use href="#MJMAIN-2208" x="1338" y="0"></use><use href="#MJFRAK-52" x="2283" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-2">w_i\in\Re</script>，此外还有一个<strong>偏置项</strong><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-3-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 2481.0555555555557 775.4001387359851" style="width: 5.806ex; height: 1.815ex; vertical-align: -0.242ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use><use href="#MJMAIN-2208" x="707" y="0"></use><use href="#MJFRAK-52" x="1652" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-3">b\in\Re</script>，就是上图中的<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-4-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 1170.406943983867 648.6635947032757" style="width: 2.661ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-30" x="1013" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-4">w_0</script>。</p></li>
<li><p><strong>激活函数</strong> 感知器的激活函数可以有很多选择，比如我们可以选择下面这个<strong>阶跃函数</strong><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-5-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -725.2000693679926 550.5 950.4001387359851" style="width: 1.331ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use></g></svg></span><script type="math/tex" id="MathJax-Element-5">f</script>来作为激活函数：</p></li>
</ul><div class="md-section-divider"></div><p data-anchor-id="19qi"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-6-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1469.7000693679925 44270.673387096766 2439.400138735985" style="width: 102.823ex; height: 5.685ex; vertical-align: -2.298ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(16788,0)"><g transform="translate(-15,0)"><use href="#MJMATHI-66"></use><use href="#MJMAIN-28" x="550" y="0"></use><use href="#MJMATHI-7A" x="940" y="0"></use><use href="#MJMAIN-29" x="1408" y="0"></use><use href="#MJMAIN-3D" x="2075" y="0"></use><g transform="translate(3132,0)"><use href="#MJSZ3-7B"></use><g transform="translate(917,0)"><g transform="translate(-15,0)"><g transform="translate(0,550)"><use href="#MJMAIN-31"></use><use href="#MJMATHI-7A" x="2500" y="0"></use><use href="#MJMAIN-3E" x="3246" y="0"></use><use href="#MJMAIN-30" x="4303" y="0"></use></g><g transform="translate(0,-650)"><use href="#MJMAIN-30"></use><use href="#MJMATHI-6F" x="2500" y="0"></use><use href="#MJMATHI-74" x="2986" y="0"></use><use href="#MJMATHI-68" x="3347" y="0"></use><use href="#MJMATHI-65" x="3924" y="0"></use><use href="#MJMATHI-72" x="4390" y="0"></use><use href="#MJMATHI-77" x="4842" y="0"></use><use href="#MJMATHI-69" x="5558" y="0"></use><use href="#MJMATHI-73" x="5904" y="0"></use><use href="#MJMATHI-65" x="6373" y="0"></use></g></g></g></g></g></g><g transform="translate(42191,0)"><g id="mjx-eqn-1"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-6">
f(z)=\begin{equation}\begin{cases}1\qquad z>0\\0\qquad otherwise\end{cases}\end{equation}
</script><p></p><ul data-anchor-id="mqrd">
<li><strong>输出</strong> 感知器的输出由下面这个公式来计算</li>
</ul><div class="md-section-divider"></div><p data-anchor-id="e47i"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-7-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -904.613537109928 11955.605089605735 1288.3956226069529" style="width: 27.823ex; height: 3.024ex; vertical-align: -0.968ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use><use href="#MJMAIN-3D" x="775" y="0"></use><use href="#MJMATHI-66" x="1831" y="0"></use><use href="#MJMAIN-28" x="2382" y="0"></use><use href="#MJMAIN-77" x="2771" y="0"></use><use href="#MJMAIN-2219" x="3716" y="0"></use><use href="#MJMAIN-78" x="4439" y="0"></use><use href="#MJMAIN-2B" x="5189" y="0"></use><use href="#MJMATHI-62" x="6190" y="0"></use><use href="#MJMAIN-29" x="6619" y="0"></use><g transform="translate(9009,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">公</text></g><g transform="translate(9842,0)"><text font-family="STIXGeneral,&#39;Arial Unicode MS&#39;,serif" font-style="" font-weight="" stroke="none" transform="scale(52.08314516129032) matrix(1 0 0 -1 0 0)">式</text></g><use href="#MJMAIN-28" x="10676" y="0"></use><use href="#MJMAIN-31" x="11065" y="0"></use><use href="#MJMAIN-29" x="11566" y="0"></use></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-7">
y=f(\mathrm{w}\bullet\mathrm{x}+b)\qquad 公式(1)
</script> <p></p><p data-anchor-id="mfpj">如果看完上面的公式一下子就晕了，不要紧，我们用一个简单的例子来帮助理解。</p><div class="md-section-divider"></div><h4 data-anchor-id="uwb5" id="例子用感知器实现and函数">例子：用感知器实现<code>and</code>函数</h4><p data-anchor-id="9ro9">我们设计一个感知器，让它来实现<code>and</code>运算。程序员都知道，<code>and</code>是一个二元函数（带有两个参数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-8-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-8">x_1</script>和<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-9-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-9">x_2</script>），下面是它的<strong>真值表</strong>：</p><table data-anchor-id="o8fw" class="table table-striped-white table-bordered">
<thead>
<tr>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-10-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-10">x_1</script></th>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-11-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-11">x_2</script></th>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-12-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-12">y</script></th>
</tr>
</thead>
<tbody><tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>0</td>
 <td>1</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>1</td>
</tr>
</tbody></table><p data-anchor-id="b6m3">为了计算方便，我们用0表示<strong>false</strong>，用1表示<strong>true</strong>。这没什么难理解的，对于C语言程序员来说，这是天经地义的。</p><p data-anchor-id="arbf">我们令<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-13-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 12279.813887967732 928.4001387359851" style="width: 28.548ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use><use href="#MJMAIN-3D" x="1448" y="0"></use><g transform="translate(2504,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-3B" x="3783" y="0"></use><g transform="translate(4229,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><use href="#MJMAIN-3D" x="5677" y="0"></use><g transform="translate(6733,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-3B" x="8013" y="0"></use><use href="#MJMATHI-62" x="8458" y="0"></use><use href="#MJMAIN-3D" x="9165" y="0"></use><use href="#MJMAIN-2212" x="10221" y="0"></use><g transform="translate(11000,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-38" x="779" y="0"></use></g></g></svg></span><script type="math/tex" id="MathJax-Element-13">w_1=0.5;w_2=0.5;b=-0.8</script>，而激活函数<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-14-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -725.2000693679926 550.5 950.4001387359851" style="width: 1.331ex; height: 2.177ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-66"></use></g></svg></span><script type="math/tex" id="MathJax-Element-14">f</script>就是前面写出来的<strong>阶跃函数</strong>，这时，感知器就相当于<code>and</code>函数。不明白？我们验算一下：</p><p data-anchor-id="6w5u">输入上面真值表的第一行，即<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-15-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -686.2000693679926 6167.091665745511 900.4001387359851" style="width: 14.274ex; height: 2.056ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use><use href="#MJMAIN-3D" x="1304" y="0"></use><use href="#MJMAIN-30" x="2360" y="0"></use><use href="#MJMAIN-3B" x="2860" y="0"></use><g transform="translate(3306,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-3D" x="4610" y="0"></use><use href="#MJMAIN-30" x="5666" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-15">x_1=0;x_2=0</script>，那么根据公式(1)，计算输出： <br>
<span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-16-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3398.7000693679925 44270.673387096766 6297.400138735985" style="width: 102.823ex; height: 14.637ex; vertical-align: -6.774ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(15863,0)"><g transform="translate(-15,0)"><use href="#MJMATHI-79" x="0" y="2579"></use></g><g transform="translate(761,0)"><g transform="translate(0,2579)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><use href="#MJMAIN-77" x="1996" y="0"></use><use href="#MJMAIN-2219" x="2941" y="0"></use><use href="#MJMAIN-78" x="3663" y="0"></use><use href="#MJMAIN-2B" x="4414" y="0"></use><use href="#MJMATHI-62" x="5415" y="0"></use><use href="#MJMAIN-29" x="5844" y="0"></use></g><g transform="translate(0,1277)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><g transform="translate(1996,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><g transform="translate(3166,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="4415" y="0"></use><g transform="translate(5416,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><g transform="translate(6586,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="7835" y="0"></use><use href="#MJMATHI-62" x="8835" y="0"></use><use href="#MJMAIN-29" x="9265" y="0"></use></g><g transform="translate(0,-25)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><g transform="translate(1996,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-D7" x="3498" y="0"></use><use href="#MJMAIN-30" x="4498" y="0"></use><use href="#MJMAIN-2B" x="5221" y="0"></use><g transform="translate(6222,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-D7" x="7723" y="0"></use><use href="#MJMAIN-30" x="8724" y="0"></use><use href="#MJMAIN-2212" x="9447" y="0"></use><g transform="translate(10448,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-38" x="779" y="0"></use></g><use href="#MJMAIN-29" x="11727" y="0"></use></g><g transform="translate(0,-1327)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><use href="#MJMAIN-2212" x="1996" y="0"></use><g transform="translate(2774,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-38" x="779" y="0"></use></g><use href="#MJMAIN-29" x="4054" y="0"></use></g><g transform="translate(0,-2629)"><use href="#MJMAIN-3D"></use><use href="#MJMAIN-30" x="1056" y="0"></use></g></g></g><g transform="translate(42191,0)"><g transform="translate(0,2579)"><g id="mjx-eqn-2"><use href="#MJMAIN-28"></use><use href="#MJMAIN-32" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,1277)"><g id="mjx-eqn-3"><use href="#MJMAIN-28"></use><use href="#MJMAIN-33" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-25)"><g id="mjx-eqn-4"><use href="#MJMAIN-28"></use><use href="#MJMAIN-34" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-1327)"><g id="mjx-eqn-5"><use href="#MJMAIN-28"></use><use href="#MJMAIN-35" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-2629)"><g id="mjx-eqn-6"><use href="#MJMAIN-28"></use><use href="#MJMAIN-36" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-16">
\begin{align}
y&=f(\mathrm{w}\bullet\mathrm{x}+b)\\
&=f(w_1x_1+w_2x_2+b)\\
&=f(0.5\times0+0.5\times0-0.8)\\
&=f(-0.8)\\
&=0
\end{align}
</script> <br>
也就是当<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-17-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-17">x_1</script><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-18-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-18">x_2</script>都为0的时候，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-19-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-19">y</script>为0，这就是<strong>真值表</strong>的第一行。读者可以自行验证上述真值表的第二、三、四行。<p></p><div class="md-section-divider"></div><h4 data-anchor-id="xkok" id="例子用感知器实现or函数">例子：用感知器实现<code>or</code>函数</h4><p data-anchor-id="csvj">同样，我们也可以用感知器来实现<code>or</code>运算。仅仅需要把偏置项<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-20-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-20">b</script>的值设置为-0.3就可以了。我们验算一下，下面是<code>or</code>运算的<strong>真值表</strong>：</p><table data-anchor-id="c02l" class="table table-striped-white table-bordered">
<thead>
<tr>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-21-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-21">x_1</script></th>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-22-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 1026.406943983867 632.1072455171717" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-22">x_2</script></th>
 <th><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-23-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-23">y</script></th>
</tr>
</thead>
<tbody><tr>
 <td>0</td>
 <td>0</td>
 <td>0</td>
</tr>
<tr>
 <td>0</td>
 <td>1</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>0</td>
 <td>1</td>
</tr>
<tr>
 <td>1</td>
 <td>1</td>
 <td>1</td>
</tr>
</tbody></table><p data-anchor-id="w0ao">我们来验算第二行，这时的输入是<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-24-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -686.2000693679926 6167.091665745511 900.4001387359851" style="width: 14.274ex; height: 2.056ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use><use href="#MJMAIN-3D" x="1304" y="0"></use><use href="#MJMAIN-30" x="2360" y="0"></use><use href="#MJMAIN-3B" x="2860" y="0"></use><g transform="translate(3306,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-3D" x="4610" y="0"></use><use href="#MJMAIN-31" x="5666" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-24">x_1=0;x_2=1</script>，带入公式(1)：</p><div class="md-section-divider"></div><p data-anchor-id="tx74"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-25-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -3398.7000693679925 44270.673387096766 6297.400138735985" style="width: 102.823ex; height: 14.637ex; vertical-align: -6.774ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(15863,0)"><g transform="translate(-15,0)"><use href="#MJMATHI-79" x="0" y="2579"></use></g><g transform="translate(761,0)"><g transform="translate(0,2579)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><use href="#MJMAIN-77" x="1996" y="0"></use><use href="#MJMAIN-2219" x="2941" y="0"></use><use href="#MJMAIN-78" x="3663" y="0"></use><use href="#MJMAIN-2B" x="4414" y="0"></use><use href="#MJMATHI-62" x="5415" y="0"></use><use href="#MJMAIN-29" x="5844" y="0"></use></g><g transform="translate(0,1277)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><g transform="translate(1996,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="1013" y="-213"></use></g><g transform="translate(3166,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="4415" y="0"></use><g transform="translate(5416,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="1013" y="-213"></use></g><g transform="translate(6586,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-2B" x="7835" y="0"></use><use href="#MJMATHI-62" x="8835" y="0"></use><use href="#MJMAIN-29" x="9265" y="0"></use></g><g transform="translate(0,-25)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><g transform="translate(1996,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-D7" x="3498" y="0"></use><use href="#MJMAIN-31" x="4498" y="0"></use><use href="#MJMAIN-2B" x="5221" y="0"></use><g transform="translate(6222,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-35" x="779" y="0"></use></g><use href="#MJMAIN-D7" x="7723" y="0"></use><use href="#MJMAIN-30" x="8724" y="0"></use><use href="#MJMAIN-2212" x="9447" y="0"></use><g transform="translate(10448,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-33" x="779" y="0"></use></g><use href="#MJMAIN-29" x="11727" y="0"></use></g><g transform="translate(0,-1327)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-66" x="1056" y="0"></use><use href="#MJMAIN-28" x="1606" y="0"></use><g transform="translate(1996,0)"><use href="#MJMAIN-30"></use><use href="#MJMAIN-2E" x="500" y="0"></use><use href="#MJMAIN-32" x="779" y="0"></use></g><use href="#MJMAIN-29" x="3275" y="0"></use></g><g transform="translate(0,-2629)"><use href="#MJMAIN-3D"></use><use href="#MJMAIN-31" x="1056" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(500,2579)"><g id="mjx-eqn-7"><use href="#MJMAIN-28"></use><use href="#MJMAIN-37" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(500,1277)"><g id="mjx-eqn-8"><use href="#MJMAIN-28"></use><use href="#MJMAIN-38" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(500,-25)"><g id="mjx-eqn-9"><use href="#MJMAIN-28"></use><use href="#MJMAIN-39" x="389" y="0"></use><use href="#MJMAIN-29" x="890" y="0"></use></g></g><g transform="translate(0,-1327)"><g id="mjx-eqn-10"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-30" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-2629)"><g id="mjx-eqn-11"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-31" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-25">
\begin{align}
y&=f(\mathrm{w}\bullet\mathrm{x}+b)\\
&=f(w_1x_1+w_2x_2+b)\\
&=f(0.5\times1+0.5\times0-0.3)\\
&=f(0.2)\\
&=1
\end{align}
</script><p></p><p data-anchor-id="jb25">也就是当<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-26-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -686.2000693679926 6167.091665745511 900.4001387359851" style="width: 14.274ex; height: 2.056ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-31" x="809" y="-213"></use><use href="#MJMAIN-3D" x="1304" y="0"></use><use href="#MJMAIN-30" x="2360" y="0"></use><use href="#MJMAIN-3B" x="2860" y="0"></use><g transform="translate(3306,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMAIN-32" x="809" y="-213"></use></g><use href="#MJMAIN-3D" x="4610" y="0"></use><use href="#MJMAIN-31" x="5666" y="0"></use></g></svg></span><script type="math/tex" id="MathJax-Element-26">x_1=0;x_2=1</script>时，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-27-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-27">y</script>为1，即<code>or</code><strong>真值表</strong>第二行。读者可以自行验证其它行。</p><div class="md-section-divider"></div><h3 data-anchor-id="6dzj" id="感知器还能做什么">感知器还能做什么</h3><p data-anchor-id="tye7">事实上，感知器不仅仅能实现简单的布尔运算。它可以拟合任何的线性函数，任何<strong>线性分类</strong>或<strong>线性回归</strong>问题都可以用感知器来解决。前面的布尔运算可以看作是<strong>二分类</strong>问题，即给定一个输入，输出0（属于分类0）或1（属于分类1）。如下面所示，<code>and</code>运算是一个线性分类问题，即可以用一条直线把分类0（false，红叉表示）和分类1（true，绿点表示）分开。</p><p data-anchor-id="4kw6"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-acff576747ef4259.png" alt="" title=""></p><p data-anchor-id="g2i2">然而，感知器却不能实现异或运算，如下图所示，异或运算不是线性的，你无法用一条直线把分类0和分类1分开。</p><p data-anchor-id="m7df"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-9b651d237936781c.png" alt="" title=""></p><div class="md-section-divider"></div><h3 data-anchor-id="7loz" id="感知器的训练">感知器的训练</h3><p data-anchor-id="lffc">现在，你可能困惑前面的权重项和偏置项的值是如何获得的呢？这就要用到感知器训练算法：将权重项和偏置项初始化为0，然后，利用下面的<strong>感知器规则</strong>迭代的修改<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-28-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 1060.805392899952 640.8854201102238" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-28">w_i</script>和<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-29-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-29">b</script>，直到训练完成。</p><div class="md-section-divider"></div><p data-anchor-id="2b83"><span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-30-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1445.7000693679925 44270.673387096766 2391.400138735985" style="width: 102.823ex; height: 5.565ex; vertical-align: -2.298ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(18911,0)"><g transform="translate(-15,0)"><g transform="translate(0,626)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g><use href="#MJMATHI-62" x="631" y="-676"></use></g><g transform="translate(1324,0)"><g transform="translate(0,626)"><use href="#MJMAIN-2190"></use><g transform="translate(1278,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g><use href="#MJMAIN-2B" x="2561" y="0"></use><use href="#MJMAIN-394" x="3562" y="0"></use><g transform="translate(4395,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g></g><g transform="translate(0,-676)"><use href="#MJMAIN-2190"></use><use href="#MJMATHI-62" x="1278" y="0"></use><use href="#MJMAIN-2B" x="1930" y="0"></use><use href="#MJMAIN-394" x="2930" y="0"></use><use href="#MJMATHI-62" x="3764" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,626)"><g id="mjx-eqn-12"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-32" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-676)"><g id="mjx-eqn-13"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-33" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-30">
\begin{align}
w_i&\gets w_i+\Delta w_i \\
b&\gets b+\Delta b
\end{align}
</script><p></p><p data-anchor-id="61qw">其中: <br>
<span class="MathJax_Preview"></span></p><div class="MathJax_SVG_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax_SVG" id="MathJax-Element-31-Frame" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1445.7000693679925 44270.673387096766 2391.400138735985" style="width: 102.823ex; height: 5.565ex; vertical-align: -2.298ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(18554,0)"><g transform="translate(-15,0)"><g transform="translate(0,626)"><use href="#MJMAIN-394"></use><g transform="translate(833,0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g></g><g transform="translate(631,-676)"><use href="#MJMAIN-394"></use><use href="#MJMATHI-62" x="833" y="0"></use></g></g><g transform="translate(2157,0)"><g transform="translate(0,626)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-3B7" x="1056" y="0"></use><use href="#MJMAIN-28" x="1559" y="0"></use><use href="#MJMATHI-74" x="1949" y="0"></use><use href="#MJMAIN-2212" x="2533" y="0"></use><use href="#MJMATHI-79" x="3533" y="0"></use><use href="#MJMAIN-29" x="4031" y="0"></use><g transform="translate(4420,0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="809" y="-213"></use></g></g><g transform="translate(0,-676)"><use href="#MJMAIN-3D"></use><use href="#MJMATHI-3B7" x="1056" y="0"></use><use href="#MJMAIN-28" x="1559" y="0"></use><use href="#MJMATHI-74" x="1949" y="0"></use><use href="#MJMAIN-2212" x="2533" y="0"></use><use href="#MJMATHI-79" x="3533" y="0"></use><use href="#MJMAIN-29" x="4031" y="0"></use></g></g></g><g transform="translate(41690,0)"><g transform="translate(0,626)"><g id="mjx-eqn-14"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-34" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g><g transform="translate(0,-676)"><g id="mjx-eqn-15"><use href="#MJMAIN-28"></use><use href="#MJMAIN-31" x="389" y="0"></use><use href="#MJMAIN-35" x="890" y="0"></use><use href="#MJMAIN-29" x="1390" y="0"></use></g></g></g></g></svg></span></div><script type="math/tex; mode=display" id="MathJax-Element-31">
\begin{align}
\Delta w_i&=\eta(t-y)x_i \\
\Delta b&=\eta(t-y)
\end{align}
</script><p></p><p data-anchor-id="j7tk"><span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-32-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 1060.805392899952 640.8854201102238" style="width: 2.419ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-77"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="1013" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-32">w_i</script>是与输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-33-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 916.8053928999522 639.8854201102238" style="width: 2.177ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-69" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-33">x_i</script>对应的权重项，<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-34-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-34">b</script>是偏置项。事实上，可以把<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-35-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -714.2000693679926 429.5 745.4001387359851" style="width: 0.968ex; height: 1.694ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-62"></use></g></svg></span><script type="math/tex" id="MathJax-Element-35">b</script>看作是值永远为1的输入<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-36-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -462.20006936799257 976.2023625196222 639.8854201102238" style="width: 2.298ex; height: 1.452ex; vertical-align: -0.484ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-78"></use><use transform="scale(0.7071067811865476)" href="#MJMATHI-62" x="809" y="-213"></use></g></svg></span><script type="math/tex" id="MathJax-Element-36">x_b</script>所对应的权重。<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-37-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -646.2000693679926 361.5 677.4001387359851" style="width: 0.847ex; height: 1.573ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-74"></use></g></svg></span><script type="math/tex" id="MathJax-Element-37">t</script>是训练样本的<strong>实际值</strong>，一般称之为<strong>label</strong>。而<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-38-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-38">y</script>是感知器的输出值，它是根据<strong>公式(1)</strong>计算得出。<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-39-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 503.5 699.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-3B7"></use></g></svg></span><script type="math/tex" id="MathJax-Element-39">\eta</script>是一个称为<strong>学习速率</strong>的常数，其作用是控制每一步调整权的幅度。</p><p data-anchor-id="jd8j">每次从训练数据中取出一个样本的输入向量<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-40-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -451.20006936799257 528.5 471.40013873598514" style="width: 1.21ex; height: 1.089ex; vertical-align: -0.121ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMAIN-78"></use></g></svg></span><script type="math/tex" id="MathJax-Element-40">\mathrm{x}</script>，使用感知器计算其输出<span class="MathJax_Preview"></span><span class="MathJax_SVG" id="MathJax-Element-41-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;"><svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -463.20006936799257 497.5 688.4001387359851" style="width: 1.21ex; height: 1.573ex; vertical-align: -0.605ex; margin: 1px 0px;"><g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><use href="#MJMATHI-79"></use></g></svg></span><script type="math/tex" id="MathJax-Element-41">y</script>，再根据上面的规则来调整权重。每处理一个样本就调整一次权重。经过多轮迭代后（即全部的训练数据被反复处理多轮），就可以训练出感知器的权重，使之实现目标函数。</p><div class="md-section-divider"></div><h3 data-anchor-id="3rtk" id="编程实战实现感知器">编程实战：实现感知器</h3><blockquote data-anchor-id="iudd" class="white-blockquote">
  <p>完整代码请参考GitHub: <a href="https://github.com/hanbt/learn_dl/blob/master/perceptron.py" target="_blank">https://github.com/hanbt/learn_dl/blob/master/perceptron.py</a> (python2.7)</p>
</blockquote><p data-anchor-id="yjjs">对于程序员来说，没有什么比亲自动手实现学得更快了，而且，很多时候一行代码抵得上千言万语。接下来我们就将实现一个感知器。</p><p data-anchor-id="i4zr">下面是一些说明：</p><ul data-anchor-id="9wft">
<li>使用python语言。python在机器学习领域用的很广泛，而且，写python程序真的很轻松。</li>
<li>面向对象编程。面向对象是特别好的管理复杂度的工具，应对复杂问题时，用面向对象设计方法很容易将复杂问题拆解为多个简单问题，从而解救我们的大脑。</li>
<li>没有使用numpy。numpy实现了很多基础算法，对于实现机器学习算法来说是个必备的工具。但为了降低读者理解的难度，下面的代码只用到了基本的python（省去您去学习numpy的时间）。</li>
</ul><p data-anchor-id="5eia">下面是感知器类的实现，非常简单。去掉注释只有27行，而且还包括为了美观（每行不超过60个字符）而增加的很多换行。</p><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="pjgg" style=""><ol class="linenums"><li class="L0"><code class="language-python"><span class="kwd">class</span><span class="pln"> </span><span class="typ">Perceptron</span><span class="pun">(</span><span class="pln">object</span><span class="pun">):</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> __init__</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_num</span><span class="pun">,</span><span class="pln"> activator</span><span class="pun">):</span></code></li><li class="L2"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L3"><code class="language-python"><span class="str">        初始化感知器，设置输入参数的个数，以及激活函数。</span></code></li><li class="L4"><code class="language-python"><span class="str">        激活函数的类型为double -&gt; double</span></code></li><li class="L5"><code class="language-python"><span class="str">        '''</span></code></li><li class="L6"><code class="language-python"><span class="pln">        self</span><span class="pun">.</span><span class="pln">activator </span><span class="pun">=</span><span class="pln"> activator</span></code></li><li class="L7"><code class="language-python"><span class="pln">        </span><span class="com"># 权重向量初始化为0</span></code></li><li class="L8"><code class="language-python"><span class="pln">        self</span><span class="pun">.</span><span class="pln">weights </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">0.0</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> _ </span><span class="kwd">in</span><span class="pln"> range</span><span class="pun">(</span><span class="pln">input_num</span><span class="pun">)]</span></code></li><li class="L9"><code class="language-python"><span class="pln">        </span><span class="com"># 偏置项初始化为0</span></code></li><li class="L0"><code class="language-python"><span class="pln">        self</span><span class="pun">.</span><span class="pln">bias </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0.0</span></code></li><li class="L1"><code class="language-python"></code></li><li class="L2"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> __str__</span><span class="pun">(</span><span class="pln">self</span><span class="pun">):</span></code></li><li class="L3"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L4"><code class="language-python"><span class="str">        打印学习到的权重、偏置项</span></code></li><li class="L5"><code class="language-python"><span class="str">        '''</span></code></li><li class="L6"><code class="language-python"><span class="pln">        </span><span class="kwd">return</span><span class="pln"> </span><span class="str">'weights\t:%s\nbias\t:%f\n'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> </span><span class="pun">(</span><span class="pln">self</span><span class="pun">.</span><span class="pln">weights</span><span class="pun">,</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">bias</span><span class="pun">)</span></code></li><li class="L7"><code class="language-python"></code></li><li class="L8"><code class="language-python"></code></li><li class="L9"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> predict</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_vec</span><span class="pun">):</span></code></li><li class="L0"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L1"><code class="language-python"><span class="str">        输入向量，输出感知器的计算结果</span></code></li><li class="L2"><code class="language-python"><span class="str">        '''</span></code></li><li class="L3"><code class="language-python"><span class="pln">        </span><span class="com"># 把input_vec[x1,x2,x3...]和weights[w1,w2,w3,...]打包在一起</span></code></li><li class="L4"><code class="language-python"><span class="pln">        </span><span class="com"># 变成[(x1,w1),(x2,w2),(x3,w3),...]</span></code></li><li class="L5"><code class="language-python"><span class="pln">        </span><span class="com"># 然后利用map函数计算[x1*w1, x2*w2, x3*w3]</span></code></li><li class="L6"><code class="language-python"><span class="pln">        </span><span class="com"># 最后利用reduce求和</span></code></li><li class="L7"><code class="language-python"><span class="pln">        </span><span class="kwd">return</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">activator</span><span class="pun">(</span></code></li><li class="L8"><code class="language-python"><span class="pln">            reduce</span><span class="pun">(</span><span class="kwd">lambda</span><span class="pln"> a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">:</span><span class="pln"> a </span><span class="pun">+</span><span class="pln"> b</span><span class="pun">,</span></code></li><li class="L9"><code class="language-python"><span class="pln">                   map</span><span class="pun">(</span><span class="kwd">lambda</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">,</span><span class="pln"> w</span><span class="pun">):</span><span class="pln"> x </span><span class="pun">*</span><span class="pln"> w</span><span class="pun">,</span><span class="pln">  </span></code></li><li class="L0"><code class="language-python"><span class="pln">                       zip</span><span class="pun">(</span><span class="pln">input_vec</span><span class="pun">,</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">weights</span><span class="pun">))</span></code></li><li class="L1"><code class="language-python"><span class="pln">                </span><span class="pun">,</span><span class="pln"> </span><span class="lit">0.0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">bias</span><span class="pun">)</span></code></li><li class="L2"><code class="language-python"></code></li><li class="L3"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> train</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">,</span><span class="pln"> iteration</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">):</span></code></li><li class="L4"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L5"><code class="language-python"><span class="str">        输入训练数据：一组向量、与每个向量对应的label；以及训练轮数、学习率</span></code></li><li class="L6"><code class="language-python"><span class="str">        '''</span></code></li><li class="L7"><code class="language-python"><span class="pln">        </span><span class="kwd">for</span><span class="pln"> i </span><span class="kwd">in</span><span class="pln"> range</span><span class="pun">(</span><span class="pln">iteration</span><span class="pun">):</span></code></li><li class="L8"><code class="language-python"><span class="pln">            self</span><span class="pun">.</span><span class="pln">_one_iteration</span><span class="pun">(</span><span class="pln">input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">)</span></code></li><li class="L9"><code class="language-python"></code></li><li class="L0"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> _one_iteration</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">):</span></code></li><li class="L1"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L2"><code class="language-python"><span class="str">        一次迭代，把所有的训练数据过一遍</span></code></li><li class="L3"><code class="language-python"><span class="str">        '''</span></code></li><li class="L4"><code class="language-python"><span class="pln">        </span><span class="com"># 把输入和输出打包在一起，成为样本的列表[(input_vec, label), ...]</span></code></li><li class="L5"><code class="language-python"><span class="pln">        </span><span class="com"># 而每个训练样本是(input_vec, label)</span></code></li><li class="L6"><code class="language-python"><span class="pln">        samples </span><span class="pun">=</span><span class="pln"> zip</span><span class="pun">(</span><span class="pln">input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">)</span></code></li><li class="L7"><code class="language-python"><span class="pln">        </span><span class="com"># 对每个样本，按照感知器规则更新权重</span></code></li><li class="L8"><code class="language-python"><span class="pln">        </span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="pln">input_vec</span><span class="pun">,</span><span class="pln"> label</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">in</span><span class="pln"> samples</span><span class="pun">:</span></code></li><li class="L9"><code class="language-python"><span class="pln">            </span><span class="com"># 计算感知器在当前权重下的输出</span></code></li><li class="L0"><code class="language-python"><span class="pln">            output </span><span class="pun">=</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">(</span><span class="pln">input_vec</span><span class="pun">)</span></code></li><li class="L1"><code class="language-python"><span class="pln">            </span><span class="com"># 更新权重</span></code></li><li class="L2"><code class="language-python"><span class="pln">            self</span><span class="pun">.</span><span class="pln">_update_weights</span><span class="pun">(</span><span class="pln">input_vec</span><span class="pun">,</span><span class="pln"> output</span><span class="pun">,</span><span class="pln"> label</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">)</span></code></li><li class="L3"><code class="language-python"></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="kwd">def</span><span class="pln"> _update_weights</span><span class="pun">(</span><span class="pln">self</span><span class="pun">,</span><span class="pln"> input_vec</span><span class="pun">,</span><span class="pln"> output</span><span class="pun">,</span><span class="pln"> label</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">):</span></code></li><li class="L5"><code class="language-python"><span class="pln">        </span><span class="str">'''</span></code></li><li class="L6"><code class="language-python"><span class="str">        按照感知器规则更新权重</span></code></li><li class="L7"><code class="language-python"><span class="str">        '''</span></code></li><li class="L8"><code class="language-python"><span class="pln">        </span><span class="com"># 把input_vec[x1,x2,x3,...]和weights[w1,w2,w3,...]打包在一起</span></code></li><li class="L9"><code class="language-python"><span class="pln">        </span><span class="com"># 变成[(x1,w1),(x2,w2),(x3,w3),...]</span></code></li><li class="L0"><code class="language-python"><span class="pln">        </span><span class="com"># 然后利用感知器规则更新权重</span></code></li><li class="L1"><code class="language-python"><span class="pln">        delta </span><span class="pun">=</span><span class="pln"> label </span><span class="pun">-</span><span class="pln"> output</span></code></li><li class="L2"><code class="language-python"><span class="pln">        self</span><span class="pun">.</span><span class="pln">weights </span><span class="pun">=</span><span class="pln"> map</span><span class="pun">(</span></code></li><li class="L3"><code class="language-python"><span class="pln">            </span><span class="kwd">lambda</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">,</span><span class="pln"> w</span><span class="pun">):</span><span class="pln"> w </span><span class="pun">+</span><span class="pln"> rate </span><span class="pun">*</span><span class="pln"> delta </span><span class="pun">*</span><span class="pln"> x</span><span class="pun">,</span></code></li><li class="L4"><code class="language-python"><span class="pln">            zip</span><span class="pun">(</span><span class="pln">input_vec</span><span class="pun">,</span><span class="pln"> self</span><span class="pun">.</span><span class="pln">weights</span><span class="pun">))</span></code></li><li class="L5"><code class="language-python"><span class="pln">        </span><span class="com"># 更新bias</span></code></li><li class="L6"><code class="language-python"><span class="pln">        self</span><span class="pun">.</span><span class="pln">bias </span><span class="pun">+=</span><span class="pln"> rate </span><span class="pun">*</span><span class="pln"> delta</span></code></li></ol></pre><p data-anchor-id="clua">接下来，我们利用这个感知器类去实现<code>and</code>函数。</p><div class="md-section-divider"></div><pre class="prettyprint linenums prettyprinted" data-anchor-id="l2u0" style=""><ol class="linenums"><li class="L0"><code class="language-python"><span class="kwd">def</span><span class="pln"> f</span><span class="pun">(</span><span class="pln">x</span><span class="pun">):</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="str">'''</span></code></li><li class="L2"><code class="language-python"><span class="str">    定义激活函数f</span></code></li><li class="L3"><code class="language-python"><span class="str">    '''</span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="kwd">return</span><span class="pln"> </span><span class="lit">1</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> x </span><span class="pun">&gt;</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="lit">0</span></code></li><li class="L5"><code class="language-python"></code></li><li class="L6"><code class="language-python"></code></li><li class="L7"><code class="language-python"><span class="kwd">def</span><span class="pln"> get_training_dataset</span><span class="pun">():</span></code></li><li class="L8"><code class="language-python"><span class="pln">    </span><span class="str">'''</span></code></li><li class="L9"><code class="language-python"><span class="str">    基于and真值表构建训练数据</span></code></li><li class="L0"><code class="language-python"><span class="str">    '''</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="com"># 构建训练数据</span></code></li><li class="L2"><code class="language-python"><span class="pln">    </span><span class="com"># 输入向量列表</span></code></li><li class="L3"><code class="language-python"><span class="pln">    input_vecs </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[[</span><span class="lit">1</span><span class="pun">,</span><span class="lit">1</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">0</span><span class="pun">,</span><span class="lit">0</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="lit">0</span><span class="pun">],</span><span class="pln"> </span><span class="pun">[</span><span class="lit">0</span><span class="pun">,</span><span class="lit">1</span><span class="pun">]]</span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="com"># 期望的输出列表，注意要与输入一一对应</span></code></li><li class="L5"><code class="language-python"><span class="pln">    </span><span class="com"># [1,1] -&gt; 1, [0,0] -&gt; 0, [1,0] -&gt; 0, [0,1] -&gt; 0</span></code></li><li class="L6"><code class="language-python"><span class="pln">    labels </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">]</span></code></li><li class="L7"><code class="language-python"><span class="pln">    </span><span class="kwd">return</span><span class="pln"> input_vecs</span><span class="pun">,</span><span class="pln"> labels    </span></code></li><li class="L8"><code class="language-python"></code></li><li class="L9"><code class="language-python"></code></li><li class="L0"><code class="language-python"><span class="kwd">def</span><span class="pln"> train_and_perceptron</span><span class="pun">():</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="str">'''</span></code></li><li class="L2"><code class="language-python"><span class="str">    使用and真值表训练感知器</span></code></li><li class="L3"><code class="language-python"><span class="str">    '''</span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="com"># 创建感知器，输入参数个数为2（因为and是二元函数），激活函数为f</span></code></li><li class="L5"><code class="language-python"><span class="pln">    p </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Perceptron</span><span class="pun">(</span><span class="lit">2</span><span class="pun">,</span><span class="pln"> f</span><span class="pun">)</span></code></li><li class="L6"><code class="language-python"><span class="pln">    </span><span class="com"># 训练，迭代10轮, 学习速率为0.1</span></code></li><li class="L7"><code class="language-python"><span class="pln">    input_vecs</span><span class="pun">,</span><span class="pln"> labels </span><span class="pun">=</span><span class="pln"> get_training_dataset</span><span class="pun">()</span></code></li><li class="L8"><code class="language-python"><span class="pln">    p</span><span class="pun">.</span><span class="pln">train</span><span class="pun">(</span><span class="pln">input_vecs</span><span class="pun">,</span><span class="pln"> labels</span><span class="pun">,</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0.1</span><span class="pun">)</span></code></li><li class="L9"><code class="language-python"><span class="pln">    </span><span class="com">#返回训练好的感知器</span></code></li><li class="L0"><code class="language-python"><span class="pln">    </span><span class="kwd">return</span><span class="pln"> p</span></code></li><li class="L1"><code class="language-python"></code></li><li class="L2"><code class="language-python"></code></li><li class="L3"><code class="language-python"><span class="kwd">if</span><span class="pln"> __name__ </span><span class="pun">==</span><span class="pln"> </span><span class="str">'__main__'</span><span class="pun">:</span><span class="pln"> </span></code></li><li class="L4"><code class="language-python"><span class="pln">    </span><span class="com"># 训练and感知器</span></code></li><li class="L5"><code class="language-python"><span class="pln">    and_perception </span><span class="pun">=</span><span class="pln"> train_and_perceptron</span><span class="pun">()</span></code></li><li class="L6"><code class="language-python"><span class="pln">    </span><span class="com"># 打印训练获得的权重</span></code></li><li class="L7"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> and_perception</span></code></li><li class="L8"><code class="language-python"><span class="pln">    </span><span class="com"># 测试</span></code></li><li class="L9"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'1 and 1 = %d'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> and_perception</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">])</span></code></li><li class="L0"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'0 and 0 = %d'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> and_perception</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">])</span></code></li><li class="L1"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'1 and 0 = %d'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> and_perception</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">])</span></code></li><li class="L2"><code class="language-python"><span class="pln">    </span><span class="kwd">print</span><span class="pln"> </span><span class="str">'0 and 1 = %d'</span><span class="pln"> </span><span class="pun">%</span><span class="pln"> and_perception</span><span class="pun">.</span><span class="pln">predict</span><span class="pun">([</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">])</span></code></li></ol></pre><p data-anchor-id="y2uc">将上述程序保存为perceptron.py文件，通过命令行执行这个程序，其运行结果为：</p><p data-anchor-id="o6n4"><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/2256672-1e66158656366b57.png" alt="" title=""></p><p data-anchor-id="ymd7">神奇吧！感知器竟然完全实现了<code>and</code>函数。读者可以尝试一下利用感知器实现其它函数。</p><div class="md-section-divider"></div><h2 data-anchor-id="mj9j" id="小结">小结</h2><p data-anchor-id="nl0f">终于看（写）到小结了...，大家都累了。对于零基础的你来说，走到这里应该已经很烧脑了吧。没关系，休息一下。值得高兴的是，你终于已经走出了深度学习入门的第一步，这是巨大的进步；坏消息是，这仅仅是最简单的部分，后面还有无数艰难险阻等着你。不过，你学的困难往往意味着别人学的也困难，掌握一门高门槛的技艺，进可糊口退可装逼，是很值得的。</p><p data-anchor-id="0lwc">下一篇文章，我们将讨论另外一种感知器：<strong>线性单元</strong>，并由此引出一种可能是最最重要的优化算法：<strong>梯度下降</strong>算法。</p><div class="md-section-divider"></div><h2 data-anchor-id="wc4s" id="参考资料">参考资料</h2><ol data-anchor-id="dct2">
<li>Tom M. Mitchell, "机器学习", 曾华军等译, 机械工业出版社</li>
</ol></div>
    <div class="remark-icons"><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="1uus">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="clw6">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="4s1h">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="49jw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="tct5">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="39pi">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="p3bc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ij0c">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="bm8i">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="l9z0">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="s1bw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="t4bg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="szvi">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="r9m3">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="6ag5">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="k7nn">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="tf0a">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ijil">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="y0ke">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="3svx">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="19qi">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="mqrd">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="e47i">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="mfpj">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="uwb5">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="9ro9">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="o8fw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="b6m3">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="arbf">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="6w5u">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="xkok">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="csvj">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="c02l">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="w0ao">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="tx74">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="jb25">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="6dzj">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="tye7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="4kw6">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="g2i2">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="m7df">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="7loz">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="lffc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="2b83">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="61qw">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="j7tk">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="jd8j">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="3rtk">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="iudd">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="yjjs">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="i4zr">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="9wft">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="5eia">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="pjgg">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="clua">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="l2u0">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="y2uc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="o6n4">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="ymd7">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="mj9j">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="nl0f">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="0lwc">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="wc4s">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div><div class="remark-icon unselectable remark-icon-empty" style="display: none;" data-anchor-id="dct2">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div></div>
</div>

<!--in page preview buttons. -->
<div class="in-page-preview-buttons in-page-preview-buttons-full-reader">
    <ul>
        <li class="in-page-button dropdown" id="preview-toc-button" title="内容目录 Ctrl+Alt+O">
            <span class="dropdown-toggle icon-list" data-toggle="dropdown" style="color: rgba(102, 128, 153, 0.45);"></span>
            <div id="toc-list" class="dropdown-menu theme pull-right theme-white"> <!-- Add theme means this element will be changed when apply theme color. -->
                <h3>内容目录</h3>
                <hr>
                <div class="table-of-contents"><div class="toc">
<ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E9%9B%B6%E5%9F%BA%E7%A1%80%E5%85%A5%E9%97%A8%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A01-%E6%84%9F%E7%9F%A5%E5%99%A8">零基础入门深度学习(1) - 感知器</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8">文章列表</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0%E6%98%AF%E5%95%A5">深度学习是啥</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%84%9F%E7%9F%A5%E5%99%A8">感知器</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%84%9F%E7%9F%A5%E5%99%A8%E7%9A%84%E5%AE%9A%E4%B9%89">感知器的定义</a><ul>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E4%BE%8B%E5%AD%90%E7%94%A8%E6%84%9F%E7%9F%A5%E5%99%A8%E5%AE%9E%E7%8E%B0and%E5%87%BD%E6%95%B0">例子：用感知器实现and函数</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E4%BE%8B%E5%AD%90%E7%94%A8%E6%84%9F%E7%9F%A5%E5%99%A8%E5%AE%9E%E7%8E%B0or%E5%87%BD%E6%95%B0">例子：用感知器实现or函数</a></li>
</ul>
</li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%84%9F%E7%9F%A5%E5%99%A8%E8%BF%98%E8%83%BD%E5%81%9A%E4%BB%80%E4%B9%88">感知器还能做什么</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E6%84%9F%E7%9F%A5%E5%99%A8%E7%9A%84%E8%AE%AD%E7%BB%83">感知器的训练</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E7%BC%96%E7%A8%8B%E5%AE%9E%E6%88%98%E5%AE%9E%E7%8E%B0%E6%84%9F%E7%9F%A5%E5%99%A8">编程实战：实现感知器</a></li>
</ul>
</li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E5%B0%8F%E7%BB%93">小结</a></li>
<li><a href="https://www.zybuluo.com/hanbingtao/note/433855#%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99">参考资料</a></li>
</ul>
</li>
</ul>
</div>
</div>
            </div>
        </li>
    </ul>
</div>

<div id="reader-full-toolbar" class="reader-full-toolbar-shown" style="padding-top: 0;">
    <ul id="reader-full-toolbar-home" class="preview-button-row">
        <li class="preview-button-full-reader" id="preview-editor-button" title="撰写文本 Ctrl+Alt+M">
            <span class="icon-pencil" style="color: rgb(187, 187, 187);"></span>
        </li>
    </ul>
    <ul id="preview-button-row" class="preview-button-row">
        <li class="preview-button-full-reader dropdown" id="preview-list-button" title="文本列表 Ctrl+Alt+F">
            <span class="dropdown-toggle icon-reorder" data-toggle="dropdown" style="color: rgb(187, 187, 187);"></span>
            <ul id="file-list" class="dropdown-menu theme-black pull-right" role="menu" style="max-height: 652px;">
                    <li>
                    <ul class="tag-list">
                        <li class="tag-item item" tag-name="机器学习">
                            <span class="pull-left"><i class="icon-tag"></i><span class="tag-name">机器学习</span></span>
                            <span class="tag-count pull-right">7</span>
                            <div class="clearfix"></div>
                        </li>
                            
    <li class="file-item item" file-created-date="2017-02-28 00:59:57">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/626300" title="【已发布】 2017-08-29 23:41">
        <i class="icon-share-sign"></i>
        <span id="626300">零基础入门深度学习(7) - 递归神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2017-01-08 23:28:36">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/581764" title="【已发布】 2017-08-28 19:55">
        <i class="icon-share-sign"></i>
        <span id="581764">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-11-05 19:16:51">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/541458" title="【已发布】 2017-08-28 19:54">
        <i class="icon-share-sign"></i>
        <span id="541458">零基础入门深度学习(5) - 循环神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-10-09 20:30:46">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/485480" title="【已发布】 2017-08-28 19:53">
        <i class="icon-share-sign"></i>
        <span id="485480">零基础入门深度学习(4) - 卷积神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-08-24 21:39:25">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/476663" title="【已发布】 2017-10-17 22:25">
        <i class="icon-share-sign"></i>
        <span id="476663">零基础入门深度学习(3) - 神经网络和反向传播算法</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-26 01:44:30">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/448086" title="【已发布】 2017-08-28 19:40">
        <i class="icon-share-sign"></i>
        <span id="448086">零基础入门深度学习(2) - 线性单元和梯度下降</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-12 11:10:42">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/433855" title="【已发布】 2017-08-28 19:35">
        <i class="icon-share-sign"></i>
        <span id="433855" class="whiter-on-black">零基础入门深度学习(1) - 感知器</span>
        </a>
    </li>

                    </ul>
                    </li>
                    <li>
                    <ul class="tag-list">
                        <li class="tag-item item" tag-name="深度学习入门">
                            <span class="pull-left"><i class="icon-tag"></i><span class="tag-name">深度学习入门</span></span>
                            <span class="tag-count pull-right">7</span>
                            <div class="clearfix"></div>
                        </li>
                            
    <li class="file-item item" file-created-date="2017-02-28 00:59:57">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/626300" title="【已发布】 2017-08-29 23:41">
        <i class="icon-share-sign"></i>
        <span id="626300">零基础入门深度学习(7) - 递归神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2017-01-08 23:28:36">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/581764" title="【已发布】 2017-08-28 19:55">
        <i class="icon-share-sign"></i>
        <span id="581764">零基础入门深度学习(6) - 长短时记忆网络(LSTM)</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-11-05 19:16:51">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/541458" title="【已发布】 2017-08-28 19:54">
        <i class="icon-share-sign"></i>
        <span id="541458">零基础入门深度学习(5) - 循环神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-10-09 20:30:46">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/485480" title="【已发布】 2017-08-28 19:53">
        <i class="icon-share-sign"></i>
        <span id="485480">零基础入门深度学习(4) - 卷积神经网络</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-08-24 21:39:25">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/476663" title="【已发布】 2017-10-17 22:25">
        <i class="icon-share-sign"></i>
        <span id="476663">零基础入门深度学习(3) - 神经网络和反向传播算法</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-26 01:44:30">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/448086" title="【已发布】 2017-08-28 19:40">
        <i class="icon-share-sign"></i>
        <span id="448086">零基础入门深度学习(2) - 线性单元和梯度下降</span>
        </a>
    </li>

                            
    <li class="file-item item" file-created-date="2016-07-12 11:10:42">
        <a tabindex="-1" href="https://www.zybuluo.com/hanbingtao/note/433855" title="【已发布】 2017-08-28 19:35">
        <i class="icon-share-sign"></i>
        <span id="433855" class="whiter-on-black">零基础入门深度学习(1) - 感知器</span>
        </a>
    </li>

                    </ul>
                    </li>
            </ul>
            <ul id="file-list-topbar" class="dropdown-menu theme-black pull-right" role="menu">
                <li id="search-file-bar">
                    <i class="icon-search icon-large"></i>
                    <input type="text" id="search-file-textbox" placeholder="搜索 hanbingtao 的文稿标题， * 显示全部">
                    <i class="icon-level-down icon-rotate-90 icon-large"></i>
                </li>
                <li id="tag-file-bar">
                    以下【标签】将用于标记这篇文稿：
                </li>
            </ul>
        </li>
        <li class="preview-button-full-reader" id="preview-theme-button" title="主题切换 Ctrl+Alt+Y">
            <span class="icon-adjust" style="color: rgb(187, 187, 187);"></span>
        </li>
        <li class="preview-button-full-reader" id="preview-fullscreen-button" title="全屏模式 F11">
            <span class="icon-fullscreen" style="color: rgb(187, 187, 187);"></span>
        </li>
        <li class="preview-button-full-reader wmd-spacer"></li>
        <li class="preview-button-full-reader dropdown" id="preview-about-button" title="关于本站">
            <span class="dropdown-toggle icon-info-sign" data-toggle="dropdown" data-hover="dropdown" data-delay="100" data-close-others="true" style="color: rgb(187, 187, 187);"></span>
            <ul id="about-menu" class="dropdown-menu theme-black pull-right" role="menu">
                <li title="下载全平台客户端"><a tabindex="-1" href="https://www.zybuluo.com/cmd" target="_blank"><i class="icon-laptop"></i>下载客户端</a></li>
                <li title="@ghosert"><a tabindex="-1" href="http://www.weibo.com/ghosert" target="_blank"><i class="icon-weibo"></i>关注开发者</a></li>
                <li title=""><a tabindex="-1" href="https://github.com/ghosert/cmd-editor/issues" target="_blank"><i class="icon-github-alt"></i>报告问题，建议</a></li>
                <li title="support@zybuluo.com"><a tabindex="-1" href="mailto:support@zybuluo.com" target="_blank"><i class="icon-envelope"></i>联系我们</a></li>
            </ul>
        </li>
    </ul>
</div>
<ul id="reader-full-toolbar-tail" class="reader-full-toolbar-tail-shown">
    <li class="preview-button-full-reader" id="preview-hidden-button" title="隐藏工具栏 Ctrl+Alt+I">
        <span class="icon-chevron-sign-right" style="color: rgb(187, 187, 187);"></span>
    </li>
</ul>






<!-- side remark, hidden when loading. -->
<div class="remark-list side-remark-hidden">
    <div class="remark-items">
    </div>
    <div class="leave-remark unselectable"><span class="icon-plus-sign-alt"></span><span>添加新批注</span></div>
    <div class="new-remark">
    <div class="remark-head"><a><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg" style="width: 32px; height: 32px;"></a></div>
    <div class="remark-author unselectable"><strong>markliu2019</strong></div>
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
    </div>

        <!-- clone the template $('.new-remark-reply').html() to here.-->
        <div class="remark-notice">在作者公开此批注前，只有你和作者可见。</div>
    </div>
</div>

<!-- template for new remark/reply -->
<div class="new-remark-reply side-remark-hidden">
    <div class="remark-head"><a><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg"></a></div>
    <div class="remark-author unselectable"></div>
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
    </div>
</div>

<!-- template for .remark-item/.remark-reply -->
<div class="remark-item-reply side-remark-hidden">
    <div class="remark-head"><a><img src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/default-head.jpg"></a></div>
    <div class="remark-author unselectable"></div>
    <div class="remark-delete-link unselectable"><span class="icon-remove"></span></div> <!--This is mainly for deleting remark-reply, shown when author/remark hovering on remark-reply.-->
    <div class="remark-editor" contenteditable="true" spellcheck="false"></div>
    <!-- this will be filled up by js.
    <div class="inline-error">402/400</div> for new remark
    <div class="inline-error">202/200</div> for new reply
    -->
    <div class="remark-footer unselectable">
        <button class="remark-edit btn-link">修改</button>
        <button class="remark-save btn-link">保存</button>
        <button class="remark-cancel btn-link">取消</button>
        <button class="remark-delete btn-link">删除</button>
    </div>
</div>

<!-- template for remark-item-->
<div class="remark-item side-remark-hidden" data-rand-id="" data-version-id="">
    <div class="remark-published-link unselectable"><span class="icon-link icon-rotate-90"></span></div>
    <ul class="remark-options theme unselectable theme-white">
        <li class="remark-private"><span class="icon-eye-close"></span><span>私有</span></li>
        <li class="remark-public"><span class="icon-group"></span><span>公开</span></li>
        <li class="remark-delete"><span class="icon-remove"></span><span>删除</span></li>
    </ul>

    <!-- clone the template $('.remark-item-reply').html() to here.-->

    <button class="remark-reply-view-more btn-link">查看更早的 5 条回复</button>
    <div class="remark-replies">
        <!--
        <div class="remark-reply">
            clone the template $('.remark-item-reply').html() to here.
        </div>
        -->
    </div>

    <div class="leave-reply unselectable"><span>回复批注</span></div>
    <div class="new-reply">
        <!-- clone the template $('.new-remark-reply').html() to here.-->
    </div>
</div>

<!-- jiawzhang NOTICE: .remark-icons will be put to mdeditor.mako and user_note.mako, where next to .wmd-preview -->
<!-- <div class="remark-icons"></div> -->

<!-- template for remark-icon -->
<div class="remark-icon unselectable side-remark-hidden remark-icon-empty" style="display: none;">
    <span class="icon-stack">
        <i class="glyph-comment"></i>
        <span class="remark-count"></span>
    </span>
</div>


<!-- canvas, hidden always, this is used to convert svg to canvas and then convert canvas to png. -->
<canvas id="svg-canvas-image" class="editor-reader-hidden-always"></canvas>

<!-- This is the image panel to hold enlarged image/svg. -->
<div id="large-image-panel">
    <img id="large-image">
</div>


    


    <!-- Hidden Popup Modal -->
    <div id="notification-popup-window" class="modal hide fade theme theme-white" tabindex="-1" role="dialog" aria-labelledby="notification-title" aria-hidden="true">
        <div class="modal-header theme theme-white">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="notification-title">通知</h3>
        </div>
        <div class="modal-body theme theme-white">
            <p></p>
        </div>
        <div class="modal-footer theme theme-white">
            <button id="notification-cancel" class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
            <button id="notification-confirm" class="btn btn-primary">确认</button>
        </div>
    </div>

    <!-- zybuluo's foot -->

    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/288313bb.base.lib.min.js"></script>

    <script>
        Namespace('com.zybuluo.base');
        com.zybuluo.base.initData = {
            globalPromptUrl: "https://www.zybuluo.com/global/prompt",
        };
    </script>

    
    <!--mathjax-->
    <!--blacker: 1 below means font weight.-->
    <script type="text/x-mathjax-config;executed=true">
        MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]], processEscapes: true }, TeX: { equationNumbers: { autoNumber: "AMS" } }, messageStyle: "none", SVG: { blacker: 1 }});
    </script>
    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/mathJax.js"></script>
    <!--mathjax source code is here: https://github.com/mathjax/MathJax.-->
    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/mathJax(1).js"></script>

    <script>
        Namespace('com.zybuluo.mdeditor.layout');
        com.zybuluo.mdeditor.layout.initData = {
            // '' means not logged in, otherwise the logged in username, for mdeditor.mako, this value will be reset in render.js otherwise, for user_note.mako, it's rendered by server side.
            loggedInUsername: 'markliu2019',
            isPageOwner: 'False' === 'True' ? true : false,
            loginComeFromUrl: 'https://www.zybuluo.com/login?return_to=https%3A%2F%2Fwww.zybuluo.com%2Fhanbingtao%2Fnote%2F433855',
            noteRemarksUrl: "https://www.zybuluo.com/note/433855/remarks", 
            newNoteRemarkUrl: "https://www.zybuluo.com/note/433855/remark/new", 
            updateNoteRemarkUrl: "https://www.zybuluo.com/note/433855/remark/update", 
            deleteNoteRemarkUrl: "https://www.zybuluo.com/note/433855/remark/delete", 
            publishNoteRemarkUrl: "https://www.zybuluo.com/note/433855/remark/publish", 
            newNoteRemarkReplyUrl: "https://www.zybuluo.com/note/433855/remark_reply/new", 
            updateNoteRemarkReplyUrl: "https://www.zybuluo.com/note/433855/remark_reply/update", 
            deleteNoteRemarkReplyUrl: "https://www.zybuluo.com/note/433855/remark_reply/delete", 
        };

        // BEGIN: pace.js configuration
        window.paceOptions = {
            // disable others, enable for ajax call only,
            ajax: true,
            document: false,
            elements: false,
            eventLag: false,
        };
        // jiawzhang NOTICE: to make sure pace.js is working for any ajax call especially the jquery ajax, add 'Pace.restart()' into jquery ajax call like '$.post'
        // Originally, pace 0.5.6 doesn't support jquery ajax, see details in: https://github.com/HubSpot/pace/issues/29
        // END: pace.js configuration

    </script>

    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/7a70106e.layout.lib.min.js"></script>

    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/dc648f35.layout.min.js"></script><div id="medium-editor-toolbar-1" class="medium-editor-toolbar"><ul id="medium-editor-toolbar-actions" class="medium-editor-toolbar-actions clearfix"><li><button data-action="remark" class=" medium-editor-button-first"><i class="icon-comment"></i></button></li><li><button data-action="highlight" class=" medium-editor-button-last"><i class="icon-pencil"></i></button></li></ul></div>



    

    <!-- https://www.zybuluo.com/static/assets/mdeditor/user_note.lib.min.js -->
    <!-- -->

    <script>
        Namespace('com.zybuluo.mdeditor.user_note');
        com.zybuluo.mdeditor.user_note.initData = {
            isLoggedIn: 'True',
            mdeditorUrl: "https://www.zybuluo.com/mdeditor",
            passwordPassed: 'True' === 'True' ? true : false,
        };
    </script>

    <script src="./零基础入门深度学习(1) - 感知器 - 作业部落 Cmd Markdown 编辑阅读器_files/6cd3112e.user_note.min.js"></script>





    
</body></html>